import {designPage} from "@peryl/react-compose";
import {$notice} from "plain-design";
import './resume-template-page.scss';
import {ResumeIcons} from "./ResumeIcons";
import {usePageService} from "../../modules/micro/usePageService";
import {iResumeRecord} from "./resume.utils";
import {ResumeList} from "./ResumeList";
import {iPageCardStarterOption} from "../components/PageCardStarter";

export default designPage(() => {

  const { nav } = usePageService();

  const handler = {
    handleEdit: (resume: iResumeRecord) => {
      nav.push('/react-base/resume/resume-template-edit-page', { resume });
    },
  };

  const starterOptions: iPageCardStarterOption[] = [
    {
      label: '创建空白模板', icon: ResumeIcons.file_add, handler: () => {
        nav.push('/react-base/resume/resume-template-edit-page', { resume: null });
      }
    },
    {
      label: '导入模板文件', icon: ResumeIcons.file_upload_lie, handler: () => {
        $notice.warn('未完成');
      }
    },
    {
      label: '导入模板数据', icon: ResumeIcons.file_edit_line, handler: () => {
        $notice.warn('未完成');
      }
    },
  ];

  return () => (
    <div className="resume-template-page">
      <ResumeList
        starterTitle="创建模板"
        isTemplate="Y"
        editText="编辑模板"
        copyText="复制模板"
        handleEdit={handler.handleEdit}
        starterOptions={starterOptions}
      />
    </div>

  );

});
